<%@page contentType="text/html; charset=utf-8" %>
<%@ include file="/commons/taglibs.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>高级查询</title>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/public.js"></script>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/global.js"></script>
<link href="${ctx}/styles/aux_window.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/styles/public.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/tags/unitedselect/UnitedSelect.js"></script>
<script type="text/javascript" src="${ctx}/scripts/common.js"></script>
<script type="text/javascript" src="${ctx}/scripts/div/common.js"></script>
<%@ include file="/commons/dateTime.jsp"%>
<%@ include file="/commons/validation.jsp"%>
<script type="text/javascript">
	function submitForm(){ //提交查询  先保存查询条件 然后刷新列表
		var flag = $("custServiceEventForm").fireEvent("onsubmit");
		if(!flag) return;
		var url = "${ctx}/customerService_custServEventAction.do?method=setCustomerEventSearchCondition";
		var params = $("custServiceEventForm").serialize();
		sendAjaxRequest(url,params,function(){
			findFrame("main").refleshFrame(); //刷新主页面列表
			windowClose();
		});
	}

	function openHouseSelect(){ //打开选房间的页面
		var ownerUrl = "${ctx}/customer_chooseSingleHouseAction.do?method=chooseBuildingMain";
		ownerUrl += "&parentFrameId=gaojiSearchFrame";
		top.windowOpen(ownerUrl , "chooseBuildFrm", "选择房间",500,800);
	}

	function setHouseInfo(houseId,houseNum){ //设置房号
		document.getElementById("houseId").value = houseId;
		document.getElementById("houseNumber").value = houseNum;
	}

  function selectPerson(){ //选择人
  	var url = "${ctx}/common_employeeQuery.do?method=initSelectPsrsonMain";
  	url += "&frameName=gaojiSearchFrame";
  	url += "&callBack=selectPersonCallBack";
  	url += "&multiple=false";
	top.windowOpen(url, "selectPerson", "选择人", 530, 700,true,"selectPerson");
  }

  function selectPersonCallBack(info){//设置人的信息
	  var infos = info.split(",");
      $("recorder").value = infos[1];
  }

/***********页面私有方法**************/
function init(){
	initSelectValue("eventStatuz");
	initSelectValue("returnVisitStatuz");
	initSelectValue("reviewerStatuz");

	addUnderline("returnVisitStatuz");
	addUnderline("reviewerStatuz");
}
//为下拉框添加"-"
function addUnderline(selectId){
	var option = document.createElement("option");
	var text = document.createTextNode("--");
	option.value = "-";
	$(selectId).options.add(option,1);
	option.appendChild(text);
	$(selectId).selectedIndex = 0;
}
//修改事件状态 下拉框的value
function initSelectValue(selectId){
	var options = $(selectId).options;
	for(var i = 0; i < options.length; i++){
		if(options[i].code != "undefined" && options[i].code != null && options[i].code != "")
			options[i].value = options[i].code;
	}
}
function setServEventKindDisable(){

  if(document.getElementById("eventNatureKeyword").value==''){
  document.getElementById("custServEventKindKeyword").disabled=true;
  }else{
  document.getElementById("custServEventKindKeyword").disabled=false;
  }
}
</script>
</head>

<body onload="init();">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td colspan="2" class="window_head_outBg">
    <table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td>
        	<img src="${ctx}/images/ico_Advance.gif" align="absmiddle" />
        	<span class="window_head_intext"> 高级查询</span>
        </td>
      </tr>
    </table>
    </td>
  </tr>
  <tr>
    <td colspan="2" class="aux_header_line_1"></td>
  </tr>
  <tr>
    <td colspan="2" class="aux_header_line_2"></td>
  </tr>
  <tr>
  <form id="custServiceEventForm" action="" method="post" class="required-validate">
    <td colspan="2" class="content">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td class="aux_outtable_color">
        <table width="100%" border="0" cellpadding="0" cellspacing="1" class="aux_intable_color">
          <tr>
            <td class="aux_intable_td1">事件编号：</td>
            <td class="aux_intable_td2">
            	<input name="eventNo" type="text" class="inputtext validate-char" maxlength="36"
            		   value="" size="16" />
            </td>
          </tr>
           <tr>
            <td valign="top" class="aux_intable_td1">联系人：</td>
            <td class="aux_intable_td2">
            	<input name="contact" type="text" class="inputtext validate-char" maxlength="36"
            		   value="" size="16" />
              </td>
          </tr>
          <tr>
            <td valign="top" class="aux_intable_td1">房 号：</td>
            <td class="aux_intable_td2">
            <table border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td>
                	<input name="houseNumber" type="text" class="inputtext validate-char" value="" size="16" maxlength="10"/>
                </td>
                <td width="4">&nbsp;<input type="hidden" id="houseId" name="houseId"></td>
                <td>
                	<a href="#"  onClick="openHouseSelect();"onFocus="this.blur()">
                		<img src="${ctx}/images/ico_houesno.GIF" alt="请点选查找房号" border="0" />
                	</a>
                </td>
              </tr>
            </table></td>
          </tr>

		  <tr>
            <td valign="top" class="aux_intable_td1">详细地点：</td>
            <td class="aux_intable_td2">
              <input name="fullAddress" type="text" class="inputtext validate-char" value="" size="16" maxlength="100"/>
            </td>
          </tr>
		  <tr>
            <td class="aux_intable_td1">事件区域：</td>
            <td class="aux_intable_td2">
   				<pms:unitedSelect id="eventRegionKeyword"
   								name="eventRegionKeyword"
   								style="width:110px;"
   								dataList="${eventRegions}"
   								optionLabel="name"
   								optionValue="keyword"
   								selectText="请选择...">
   				</pms:unitedSelect>
              </td>
          </tr>
		  <tr>
            <td class="aux_intable_td1">事件性质：</td>
            <td class="aux_intable_td2">
   				<pms:unitedSelect id="eventNatureKeyword"
   								name="eventNatureKeyword"
   								style="width:110px;"
   								dataList="${eventNature}"
   								optionLabel="name"
   								optionValue="keyword"
   								isUnited="true"
   								targetId="custServEventKindKeyword"
   								actionName="customerService_custServEventAction"
   								selectText="请选择..."
   								afterOnChange="setServEventKindDisable();">
   				</pms:unitedSelect>
              </td>
          </tr>
          <tr>
            <td class="aux_intable_td1">事件类型：</td>
            <td class="aux_intable_td2">
   				<pms:unitedSelect id="custServEventKindKeyword"
   								name="custServEventKindKeyword"
   								style="width:110px;"
   								optionLabel="name"
   								optionValue="keyword"
   								dataList="${custEventKinds}"
   								selectText="请选择...">
   				</pms:unitedSelect>
              </td>
          </tr>
		    <tr>
              <td class="aux_intable_td1">事件状态：</td>
              <td class="aux_intable_td2">
				<mypms:Sysrefcode id="eventStatuz" name="eventStatuz" code="CUST_SERVICE_EVENT_EVENT_STATUZ"></mypms:Sysrefcode>
              </td>
            </tr>
            <tr>
              <td class="aux_intable_td1">回访状态：</td>
              <td class="aux_intable_td2">
	          	<mypms:Sysrefcode id="returnVisitStatuz"
	          					name="returnVisitStatuz"
	          					code="CUST_SERVICE_EVENT_RETURN_VISIT_STATUZ">
	          	</mypms:Sysrefcode>
              </td>
            </tr>
            <tr>
              <td class="aux_intable_td1">阅签状态：</td>
              <td class="aux_intable_td2"><span class="td_search">
	          	<mypms:Sysrefcode id="reviewerStatuz"
	          					name="reviewerStatuz"
	          					code="CUST_SERVICE_EVENT_REVIEWER_STATUZ">
	          	</mypms:Sysrefcode>
              </span></td>
            </tr>
            <tr>
              <td class="aux_intable_td1">记录人：</td>
              <td class="aux_intable_td2"><table border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td><input id="recorder" name="recorder" type="text" class="inputtext validate-char" value="" size="16" /></td>
                    <td width="4">&nbsp;</td>
                    <td>
                    	<a href="#"  onClick="selectPerson();" onFocus="this.blur()">
                    		<img src="${ctx}/images/ico_cz.gif" width="16" height="16" border="0" />
                    	</a>
                    </td>
                  </tr>
              </table></td>
            </tr>
            <tr>
              <td class="aux_intable_td1">记录时间：</td>
              <td class="aux_intable_td2"><table border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td>&nbsp;从&nbsp;</td>
                    <td>
                    	<input id="recorderStartTime" name="recorderStartTime" type="text" value="" size="10" maxlength="20"
                    		class="inputtext validate-dateTime-yyyy-mm-dd-HH:mm:ss less-equals-than-recorderEndTime"
                    		afterInsert="showStartMessage"/>
                    </td>
                    <td width="4">&nbsp;</td>
                    <td width="48">
                    	<img id="startImagButton" src="${ctx}/images/ico_clock.gif" width="20" height="20" />
                    	<span id="showStartMessage"></span>
                    </td>
                    <td class="btn_between_four">&nbsp;至&nbsp;</td>
                    <td>
                    	<input id="recorderEndTime" name="recorderEndTime" type="text" value="" size="10" maxlength="20"
                    		class="inputtext validate-dateTime-yyyy-mm-dd-HH:mm:ss great-equals-than-recorderStartTime"
                    		afterInsert="endImageButton"/>
                    </td>
                    <td width="4">&nbsp;</td>
                    <td>
                    	<img id="endImageButton" src="${ctx}/images/ico_clock.gif" width="20" height="20" />
                    	<span id="showEndTime"></span>
                    </td>
                  </tr>
              </table></td>
            </tr>
		  </tbody>
        </table>
		</td>
      </tr>
    </table>
    </td>
    </form>
  </tr>
  <tr>

    <td class="window_footer"><table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><table border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td class="buttonOffLeft" id="btn1_11"></td>
            <td class="buttonOffMiddle"
            	id="btn1_12"
            	onClick="submitForm();"
            	onMouseOver="btn_change_over(1)"
            	onMouseOut="btn_change_out(1)"
            	onBlur="btn_change(1)">
            	<img src="${ctx}/images/ico_ok.gif" alt="" width="14" height="14" border="0" align="absbottom" />
            		确 定
            </td>
            <td class="buttonOffRight" id="btn1_13"></td>
          </tr>
        </table></td>
        <td class="btn_between_space"></td>
        <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_31"></td>
              <td class="buttonOffMiddle" id="btn1_32"
              	  onClick="windowClose();"
              	  onMouseOver="btn_change_over(3)"
              	  onMouseOut="btn_change_out(3)"
              	  onBlur="btn_change(3)">

              	  <img src="${ctx}/images/ico_cancel.gif" alt="" width="14" height="14" border="0" align="absbottom" />
              	  	取 消
              	</td>
              <td class="buttonOffRight" id="btn1_33"></td>
            </tr>
        </table></td>
      </tr>
    </table>
    <p>&nbsp;</p>
    <p>&nbsp;</p></td>
  </tr>
</table>
<script type="text/javascript">
			//记录开始时间
              Calendar.setup(
              {
	              inputField : "recorderStartTime", // ID of the input field
	              ifFormat : "%Y-%m-%d %H:%M:%S", // the date format
	              button : "startImagButton", // ID of the button
	              align          :    "Tl",           // alignment (defaults to "Bl")
	              showsTime      :    true,
			      singleClick    :    true
              }
              );
			//记录结束时间
              Calendar.setup(
              {
	              inputField : "recorderEndTime", // ID of the input field
	              ifFormat : "%Y-%m-%d %H:%M:%S", // the date format
	              button : "endImageButton", // ID of the button
	              align          :    "Tl",           // alignment (defaults to "Bl")
	              showsTime      :    true,
			      singleClick    :    true
              }
              );

      setServEventKindDisable();
</script>
</body>
</html>